import request from "@/utils/request.js"

/**
 * 员工登录
 * @param data 登录表单
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const login = (data) => {
  return request.post('/admin/emp/login', data)
}

/**
 * 分页查询员工
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryEmpPage = (data) => {
  return request.post('/admin/emp/page', data)
}

/**
 * 通过id查询员工
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryEmpById = (data) => {
  return request.get('/admin/emp/' + data)
}

/**
 * 新增员工
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const saveEmp = (data) => {
  return request.post('/admin/emp', data)
}

/**
 * 删除员工
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const removeEmp = (data) => {
  return request.delete('/admin/emp', {data})
}

/**
 * 更新员工
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const updateEmp = (data) => {
  return request.put('/admin/emp', data)
}

/**
 * 重置员工密码
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const resetPwd = (data) => {
  return request.put('/admin/emp/password/' + data)
}

/**
 * 通过token查询员工信息
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryEmpInfoByToken = () => {
  return request.get('/admin/emp/info')
}

/**
 * 员工修改个人信息
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const empEditInfo = (data) => {
  return request.post('/admin/emp/edit', data)
}

/**
 * 员工修改密码
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const empEditPwd = (data) => {
  return request.post('/admin/emp/pw', data)
}
/**
 * 导出员工表格
 */
export const exportEmp = (data) => {
  return request.post('/admin/emp/export', data , {responseType: 'blob'})
}
